package com.ecr.hub.model.user;

import java.util.Date;

import com.ecr.hub.model.AbstractBaseHub;

public class User extends AbstractBaseHub {

	private static final long serialVersionUID = 1L;

	private String firstName;
	private String lastName;
	private String login;
	private String password;
	private String passwordConfirm;
	private Date creationDate;
	private boolean active;
	private boolean askForPassword;
	private boolean indelible;
	private String sessionId;
	private Role role;

	// Uniquement pour savoir si d'autres uilisateurs sont déjà connectés.
	private boolean usersAlreadyConnected;

	// ********************************
	// Les getters et setters.
	// ********************************

	public User() {
		setUsersAlreadyConnected(false);
		setRole(new Role());
	}

	public User(Role role) {
		setUsersAlreadyConnected(false);
		setCreationDate(new Date());
		setRole(role);
	}

	public String getFirstName() {
		return firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public String getLogin() {
		return login;
	}

	public String getPassword() {
		return password;
	}

	public String getPasswordConfirm() {
		return passwordConfirm;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public boolean isActive() {
		return active;
	}

	public Role getRole() {
		return role;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void setPasswordConfirm(String passwordConfirm) {
		this.passwordConfirm = passwordConfirm;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	public boolean isAskForPassword() {
		return askForPassword;
	}

	public void setAskForPassword(boolean askForPassword) {
		this.askForPassword = askForPassword;
	}

	public boolean isIndelible() {
		return indelible;
	}

	public void setIndelible(boolean indelible) {
		this.indelible = indelible;
	}

	public boolean isUsersAlreadyConnected() {
		return usersAlreadyConnected;
	}

	public void setUsersAlreadyConnected(boolean usersAlreadyConnected) {
		this.usersAlreadyConnected = usersAlreadyConnected;
	}

	public String getSessionId() {
		return sessionId;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}
}
